﻿using Microsoft.AspNetCore.Http;
using System.Threading;
using System.Threading.Tasks;
using YFurion.Application;

namespace UpperComputer.Application
{
    public interface IBaseUserService : IEFCoreApplicationService<BaseUserResultDto, long, BaseUserResultRequestDto, BaseUserCreateDto, BaseUserDto>
    {
        Task<string[]> GetRoleCodesCache(BaseUserDto input, CancellationToken cancellationToken = default);

        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<BaseUserResultDto> Recover(EntityDto input, CancellationToken cancellationToken = default);

        Task<BaseUserResultDto> Enable(EntityDto input, CancellationToken cancellationToken = default);

        Task<BaseUserResultDto> Disable(EntityDto input, CancellationToken cancellationToken = default);

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<BaseUserResultDto> ChangePassword(ChangePasswordDto input, CancellationToken cancellationToken = default);

        /// <summary>
        /// 更新图片
        /// </summary>
        /// <param name="file"></param>
        /// <param name="id"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<string> UploadPhoto(IFormFile file, long id, CancellationToken cancellationToken = default);

        /// <summary>
        /// 删除图片
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task DeletePhoto(BaseUserDto input, CancellationToken cancellationToken = default);

        /// <summary>
        /// 编辑用户
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<BaseUserResultDto> EditUser(BaseUserDto input, CancellationToken cancellationToken = default);

        /// <summary>
        /// 根据角色Id得到用户
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task GetUserCount(long roleId, CancellationToken cancellationToken = default);
    }
}